package com.stu.dcxy.design.creatation.simplefactory;

/**
 * @Classname WuLinSimpleFactory
 * @Version 1.0.0
 * @Date 2022/3/30 18:20
 * @Created by yd
 */
public class WuLinSimpleFactory {
    /**
     * 简单工厂
     * 违背开闭，扩展不一
     */
    public AbstractCar newCar(String name) {
        if ("van".equals(name)) {
            return new VanCar();
        } else if ("mini".equals(name)) {
            return new MiniCar();
        }
        return null;
    }
}
